package com.example.huainanlive.repository

import com.demon.net.AppResponse
import com.example.huainanlive.factory.AppResponseSecond
import com.example.huainanlive.api.AuthService
import com.example.huainanlive.ApiClient
import com.example.huainanlive.bean.*
import com.example.huainanlive.factory.s.AppResponseThrid


class DeviceRepository {

    private val authService = ApiClient.createService(AuthService::class.java)
    private val authServiceSecond = ApiClient.createServiceSecond(AuthService::class.java)
    private val authServiceThrid = ApiClient.createServiceThrid(AuthService::class.java)

    /**
     * 直播回顾
     */
    suspend fun liveHouseRecord(): AppResponseSecond<ArrayList<GetLiveHouseRecordBeanItem>> {
        return authServiceSecond.liveHouseRecord()
    }

    /**
     * 直播预告
     */
    suspend fun liveHousePreview(): AppResponse<ArrayList<GetLiveHousePreviewBeanItem>> {
        return authService.liveHousePreview()
    }

    /**
     * 查询直播预告及正在直播的详情页面
     *
     * @param liveId 直播ID
     * @return
     */
    suspend fun liveHouseDetail(liveId: Long = 0L): AppResponse<GetLiveHouseDetailBean> {
        return authService.liveHouseDetail(liveId)
    }

    /**
     * 查询直播回顾详情页面
     *
     * @param recordId 直播回顾ID
     * @return
     */
    suspend fun liveHouseRecordDetail(recordId: Long = 0L): AppResponse<GetliveHouseRecordDetailBean> {
        return authService.liveHouseRecordDetail(recordId)
    }

    /**
     * 查询直播主持人评论分页
     *
     * @param liveId 直播ID
     * @param pageSize 默认20条数据
     * @param pageNum 默认1页
     * @return
     */
    suspend fun getComment(
        liveId: Long = 0L,
        pageSize: Int = 20,
        pageNum: Int = 1
    ): AppResponseSecond<ArrayList<GetCommentItem>> {
        return authService.getComment(liveId, pageSize, pageNum)
    }

    /**
     * 查询直播用户留言分页
     *
     * @param liveId 直播ID
     * @param pageSize 默认20条数据
     * @param pageNum 默认1页
     * @return
     */
    suspend fun getMessage(
        liveId: Long = 0L,
        pageSize: Int = 0,
        pageNum: Int = 0
    ): AppResponseSecond<ArrayList<GetCommentItem>> {
        return authService.getMessage(liveId, pageSize, pageNum)
    }

    /**
     * 查询快捷词
     */
    suspend fun getWord(
        liveId: Long = 0L,
    ): AppResponse<ArrayList<GetWorldItem>> {
        return authService.getWord(liveId)
    }

    /**
     * 添加预约
     *
     */
    suspend fun addSub(
        liveId: LiveIdBean?= null
    ): AppResponseThrid<String> {
        return authServiceThrid.addSub(liveId)
    }

    /**
     * 添加预约
     *
     */
    suspend fun cancelSub(
        liveId: LiveIdBean?= null
    ): AppResponseThrid<String> {
        return authServiceThrid.cancelSub(liveId)
    }

    /**
     * 进入直播间
     *
     */
    suspend fun enterLive(
        liveId: LiveIdBean?= null
    ): AppResponseThrid<String> {
        return authServiceThrid.enterLive(liveId)
    }

    /**
     * 添加留言
     */
    suspend fun addMsg(
        addMsgBean: AddMsgBean? = null
    ): AppResponseThrid<String> {
        return authServiceThrid.addMsg(addMsgBean)
    }

    /**
     * 点赞
     */
    suspend fun addZan(
        addZanBean: AddZanBean? = null
    ): AppResponseThrid<String> {
        return authServiceThrid.addZan(addZanBean)
    }
    /**
     * 离开直播间
     */
    suspend fun leaveLive(
        addZanBean: LiveIdBean? = null
    ): AppResponseThrid<String> {
        return authServiceThrid.leaveLive(addZanBean)
    }


}